import moment from "moment"
import mixin from "./mixin"
import CustomFormItemWrap from "../../common/CustomFormItemWrap"
// 定义一个混入对象
const customMixin = {
  data(){
    return {
      size: "default",
      placeholder: "请输入",
      valueFormat: "YYYY-MM-DD HH:mm:ss"
    }
  },
  props: {
    ...mixin.props,
    title: {
      type: String,
      default: ""
    },
    colon: {
      type: Boolean,
      default: true
    },
    options: {
      type: Array,
      default: ()=> []
    }
  },
  methods: {
    ...mixin.methods,
    styleFilter(style){
      return {
        width: "auto",
        height: "100%",
        flex: 1
        // ...style,
        // width: style.width + style.widthUnit,
        // height: style.height + style.heightUnit,
        // fontSize: `${style.fontSize  }px`,
        // fontWeight: `${style.fontWeight  }`,
        // lineHeight: style.lineHeight + style.lineHeightUnit,
        // borderWidth: style.borderWidth + style.borderWidthUnit,
      }
    },
    disabledTime(dateTime){
      return dateTime && dateTime < moment().endOf("day")
    },
    handleChange(value ,key, componentKey){
      if(this.isPreview){
        console.log(value, key)
        this.$emit("valueChange", {
          value ,key, componentKey
        })
      }
    }
  },
  components: {
    CustomFormItemWrap
  }
}

export default customMixin
